package com.hello.booksale.service;

import com.hello.booksale.dao.CartDao;
import com.hello.booksale.entity.BookEntity;
import com.hello.booksale.entity.CartEntity;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CartService {
    @Resource
    private CartDao cartDao;

    public List<CartEntity>selectCartByUserName(String userName){
        List<CartEntity>list=cartDao.selectCartByUserName(userName);
        return list;
    }


    public void insertCart(CartEntity cartEntity){
        cartDao.insertCart(cartEntity);
    }

    public void deleteCartByBookId(int bookId,String cartTime){
        cartDao.deleteCartByBookId(bookId,cartTime);
    }

    public void deleteCartByUserName(String userName){
        cartDao.deleteCartBYUserName(userName);
    }
}